<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Bai 2.8</title>
</head>

<body>
<?php
	if(isset($_POST["hk1"])&&isset($_POST["hk2"]))
	{
		$hk1=$_POST["hk1"];
		$hk2=$_POST["hk2"];
		$dtb=($hk1+$hk2*2)/3;
		$kq=$dtb>=5?"Được lên lớp":"Ở lại lớp";
		if($dtb>=8) $xeploai="Giỏi";
		elseif($dtb>6.5) $xeploai="Khá";
		elseif($dtb>=5) $xeploai="Trung bình";
		else $xeploai="Yếu";
		
	}
?>
<form id="form1" name="form1" method="post" action="Bai2_8.php">
  <table width="350" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr bgcolor="#99FF00">
      <td colspan="2" style="text-align: center; font-weight: bold; font-style: italic;">KẾT QUẢ HỌC TẬP</td>
    </tr>
    <tr>
      <td nowrap="nowrap" bgcolor="#B649A3">Điểm HK1:</td>
      <td nowrap="nowrap" bgcolor="#B649A3"><input name="hk1" type="text" id="hk1" value="<?php echo $_POST["hk1"]; ?>" /></td>
    </tr>
    <tr>
      <td nowrap="nowrap" bgcolor="#B649A3">Điểm HK2:</td>
      <td nowrap="nowrap" bgcolor="#B649A3"><input name="hk2" type="text" id="hk2" value="<?php echo $_POST["hk2"]; ?>" /></td>
    </tr>
    <tr>
      <td nowrap="nowrap" bgcolor="#B649A3">Điểm trung bình:</td>
      <td nowrap="nowrap" bgcolor="#B649A3"><input style="background-color:#FF9" name="dtb" type="text" id="dtb" value="<?php echo $dtb;?>" readonly="readonly" /></td>
    </tr>
    <tr>
      <td nowrap="nowrap" bgcolor="#B649A3">Kết quả:</td>
      <td nowrap="nowrap" bgcolor="#B649A3"><input style="background-color:#FF9" name="kq" type="text" id="kq" value="<?php echo $kq;?>" readonly="readonly" /></td>
    </tr>
    <tr>
      <td nowrap="nowrap" bgcolor="#B649A3">Xếp loại học lực:</td>
      <td nowrap="nowrap" bgcolor="#B649A3"><input name="xeploai" type="text" style="background-color:#FF9" id="xeploai" value="<?php echo $xeploai;?>" readonly="readonly" /></td>
    </tr>
    <tr style="text-align: center">
      <td colspan="2" nowrap="nowrap" bgcolor="#B649A3"><input type="submit" name="submit" id="submit" value="Xem kết quả" /></td>
    </tr>
  </table>
</form>
</body>
</html>